package Niuke;

import sun.jvm.hotspot.jdi.SACoreAttachingConnector;

import java.util.Scanner;

public class test2 {
    private static char[] chars=null;
    private static int s=0;
    private static int maxlen=0;
    private static int b=0;

    public static void main(String[] args) {
        Scanner scan=new Scanner(System.in);
        String s=scan.next();
        chars = s.toCharArray();
        for (int m=0;m<chars.length;m++) {
            for (int i = 0; i < chars.length; i++) {
                for (int j = 0; j < chars.length; j++) {
                    if (m> chars.length-1||m+i-1>chars.length-1||m+j>chars.length-1||m+j+i-1>chars.length-1||j==0)
                        continue;
                    process(m, i, j);
                }
            }
        }
        System.out.println((test2.s+1)+" "+(test2.s+test2.maxlen)+" "+(test2.s+b+1)+" "+(test2.s+test2.maxlen+b));
    }

    public static void process(int start,int len,int bias){
        //if (start> chars.length-1||start+len-1>chars.length-1||start+bias>chars.length-1||start+bias+len-1>chars.length-1||bias==0)
            //return;
        if (isSame(start,len,bias)){
            if (len>maxlen){
                maxlen=len;
                s=start;
                b=bias;
            }
        }
    }

    public static boolean isSame(int start,int len,int bias){
        if (len==1) return chars[start]==chars[start+bias];
        return isSame(start,len-1,bias)&&(chars[start+len-1]==chars[start+len+bias-1]);
    }
}






/*
int n= scan.nextInt();
        int k= scan.nextInt();
        int[][] temp=new int[n+1][n+1];
        for (int i=1;i<=n;i++){
            for (int j=1;j<=n;j++){
                temp[i][j]=scan.nextInt();
            }
        }

        for (int i=1;i<=n;i++){
            int cnt=k;
            while (cnt>0) {
                for (int j = 1; j <= n; j++) {
                    for (int c = 1; c <= k; c++)
                        System.out.print(temp[i][j] + " ");
                }
                System.out.println();
                cnt--;
            }

        }
 */
